<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>

	</head>

	<body>
		<script type="text/javascript">
			var arr = [7, 4, 8, 14, 6, 3, 44, 1, 5, -6];
			//采用冒泡排序，向上冒泡，最小值在最上边  
			for(var i = 0; i < arr.length; i++) { //控制趟数  
				for(var j = i + 1; j < arr.length; j++) {
					//依次比较，如果后面的元素大于前面的元素则交换  
					if(arr[i] > arr[j]) {
						var paixu = arr[i];
						arr[i] = arr[j];
						arr[j] = paixu;
					}
				}
			}
			document.write(arr);
		</script>
	</body>

</html>